<?php
/*-------------------------------------------------------------------------\
|
|  ========================================================
|  Fusion Registry GPL
|  Copyright (C) 2007 Fusion Scripts
|
|  This program is free software; you can redistribute it and/or
|  modify it under the terms of the GNU General Public License
|  as published by the Free Software Foundation; either version 2
|  of the License, or (at your option) any later version.
|
|  This program is distributed in the hope that it will be useful,
|  but WITHOUT ANY WARRANTY; without even the implied warranty of
|  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
|  GNU General Public License for more details.
|
|  You should have received a copy of the GNU General Public License
|  along with this program; if not, write to the Free Software
|  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
|  ========================================================
|
|  Email: info@fusionscripts.com
|  Web-Site: http://www.fusionscripts.com/
|
|  $Id: ad_config.php 12 2008-08-03 05:54:08Z registry.fusion $
|
\-------------------------------------------------------------------------*/

/**
 * This is the admin interface for configuration of the Fusion Registry
 *
 * @package Fusion Registry
 * @subpackage admin
 * @version $Id: ad_config.php 12 2008-08-03 05:54:08Z registry.fusion $
 */

if ( ! defined( 'AD_REGISTRY_CALLED' ) )
{
    print "<h1>Incorrect access</h1>You cannot access this file directly.";
    exit();
}

/**
 * Fusion Registry requires
 */
require_once(AD_REGISTRY_PATH.'ad_registry_loader.php');

/**
 * Class ad_registry_config deals with configuration of the Fusion Registry
 *
 * @package Fusion Registry
 * @subpackage admin
 */
class ad_registry_config
{
    var $ipsclass;

    /** @var string */
    var $base_url;

    /** @var object */
    var $ad_registry_loader;

    /**
     * Intialization of ad_registry_config
     *
     * Another traffic cop function, there should be minimal procedural code
     * here.
     */
    function auto_run()
    {
        // Kill globals
        $tmp_in = array_merge( $_GET, $_POST, $_COOKIE );

        foreach ( $tmp_in as $k => $v )
        {
            unset($$k);
        }

        // Initialize ad_registry_loader object
        $this->ad_registry_loader = new ad_registry_loader();
        $this->ad_registry_loader->ipsclass =& $this->ipsclass;
        $this->ad_registry_loader->auto_run(&$this);

        switch($this->ipsclass->input['code'])
        {
            case 'config':
                $this->save_config();
                break;

            default:
                $this->main_menu();
                break;
        }
    }


    /**
     * Save the Fusion Registry Configuration
     */
    function save_config()
    {
        $config_list = array( 'cars_per_page',
                              'year_start',
                              'year_end',
                              'max_user_cars',
                              'allow_bbcode_car',
                              'allow_bbcode_mod',
                              'allow_bbcode_gb',
                              'allow_html_gb',
                              'allow_html_car',
                              'allow_html_mod',
                              'allow_image_upload',
                              'max_image_kbytes',
                              'max_image_resolution',
                              'max_car_images',
                              'thumbnail_resolution',
                              'allow_mod_image',
                              'allow_image_url',
                              'thumbnail_type',
                              'convert_path',
                              'convert_options',
                              'enable_guestbooks',
                              'enable_featured_item',
                              'featured_item_id',
                              'featured_item_random',
                              'featured_item_description',
                              'show_mod_gallery',
                              'limit_mod_gallery',
                              'limit_mod_gallery_amount',
                              'tmpl_newestitems_on',
                              'tmpl_newestitems_limit',
                              'tmpl_newestmods_on',
                              'tmpl_newestmods_limit',
                              'tmpl_mostmodded_on',
                              'tmpl_mostmodded_limit',
                              'tmpl_mostmoneyspent_on',
                              'tmpl_mostmoneyspent_limit',
                              'tmpl_mostviewed_on',
                              'tmpl_mostviewed_limit',
                              'tmpl_lastupdateditems_on',
                              'tmpl_lastupdateditems_limit',
                              'tmpl_lastupdateditemsmain_on',
                              'tmpl_lastupdateditemsmain_limit',
                              'tmpl_lastupdatedmods_on',
                              'tmpl_lastupdatedmods_limit',
                              'tmpl_lastcommented_on',
                              'tmpl_lastcommented_limit',
                              'date_format',
                              'remote_timeout',
                              'featured_item_only_image',
                              'main_searchmember_on',
                              'main_browse_on',
                            );

        $config_array = array();

        // Loop through and update/insert config options
        foreach ( $config_list as $config_name )
        {
            $config_array[ $config_name ] = $this->ipsclass->input[ $config_name ];
        }

        $this->ad_registry_loader->update_config($config_array);

        // Rebuild cache
        $this->update_cache();

        $text = 'Updated Fusion Registry Config';
        $url = 'act='.REGISTRY_URL.'&section=components&menu=config';
        $time = 2;

        // Big brother is watching :)
        $this->ipsclass->admin->save_log($text);

        // End of the show, c'ya
        $this->ipsclass->admin->redirect( $url, $text, 0, $time );
    }


    /**
     * Display Fusion Registry Configuration Screen
     */
    function main_menu()
    {
        $this->ipsclass->html .= $this->ipsclass->skin_acp_global->information_box( "Fusion Registry Configuration", "You may update your Fusion Registry Configuration below.".'<br />&nbsp;' ) . "<br >";

        //------------------------------
        // Fusion Registry Configuration form
        //------------------------------
        $code = "config";

        $this->ipsclass->html .= $this->ipsclass->adskin->start_form( array( 1 => array( 'code', $code      ),
                                                                             2 => array( 'act' , REGISTRY_URL ),
                                                                             3 => array( 'menu', 'config'   ),
                                                                             4 => array( 'section', 'components' ),
                                                        )      );

        $this->ipsclass->adskin->td_header[] = array( "Option"  , "40%" );

        $this->ipsclass->adskin->td_header[] = array( "Value" , "60%" );

        $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Fusion Registry General Options" );

        // Check for open_basedir
        $path_warning = '';
        $open_basedir = ini_get('open_basedir');

        if (empty($open_basedir) == FALSE)
        {
            $path_warning = "<p/><b><font color='red'>WARNING!!!</font></b> Your PHP installation is configured with the <a href='http://www.php.net/manual/en/features.safe-mode.php#ini.open-basedir' target='_blank'>open_basedir</a> restriction. You will only be able to execute external commands for thumbnail generation in the following path(s): $open_basedir<p/>If you configure thumbnail generation to an executable outside the listed path(s) it will fail to execute.";
        }

        // Check for stream_set_timeout
        $remote_timeout_warning = '';
        if ( !function_exists('stream_set_timeout') )
        {
            $remote_timeout_warning = "<p/><b><font color='red'>WARNING!!!</font></b> Your PHP version does not support the function <a href='http://www.php.net/stream_set_timeout' target='_blank'>stream_set_timeout()</a>.  The remote timeout setting in the Fusion Registry will have no affect.  This will cause problems if users attach remote images and the remote servers are slow to respond.";
        }

        // Build the Config HTML
        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Items Per Page</b><div style='color:gray'>This affects how many items are shown at once while browsing the garage.</div>",
                                                                 $this->ipsclass->adskin->form_input('cars_per_page', $this->registry_config['cars_per_page']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Year Range Beginning</b><div style='color:gray'>This is the earliest year you want to appear as a selection for the 'year' special custom field. Format CCYY</div>",
                                                                 $this->ipsclass->adskin->form_input('year_start', $this->registry_config['year_start']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Year Range Ending Offset</b><div style='color:gray'>This is the amount of years offset from the current year for the latest year you want to appear as a selection for the 'year' special custom field. If set to a positive integer the amount will be added to the current year, and if you set this to a negative integer the amount will be subtracted from the current year. Default is to offset positive 1 since model year numbers are usually one year ahead current year.</div>",
                                                                 $this->ipsclass->adskin->form_input('year_end', $this->registry_config['year_end']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Maximum allowed items per user</b>",
                                                                 $this->ipsclass->adskin->form_input('max_user_cars', $this->registry_config['max_user_cars']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Enable Latest Updated Items?</b><div style='color:gray'>Allows the latest updated items to be shown on the left column on all pages.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no( "tmpl_lastupdateditemsmain_on", $this->registry_config['tmpl_lastupdateditemsmain_on'] )
                                                                 ."<br />Max. no items to show: ".$this->ipsclass->adskin->form_input( "tmpl_lastupdateditemsmain_limit", $this->registry_config['tmpl_lastupdateditemsmain_limit'])
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Allow IBF CODE for Item Comments?</b>",
                                                                 $this->ipsclass->adskin->form_yes_no('allow_bbcode_car', $this->registry_config['allow_bbcode_car']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Allow HTML for Item Comments?</b><div style='color:gray'>This will allow HTML to be posted and executed</div>",
                                                                 $this->ipsclass->adskin->form_yes_no('allow_html_car', $this->registry_config['allow_html_car']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Allow IBF CODE for Modification Comments?</b>",
                                                                 $this->ipsclass->adskin->form_yes_no('allow_bbcode_mod', $this->registry_config['allow_bbcode_mod']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Allow HTML for Modification Comments?</b><div style='color:gray'>This will allow HTML to be posted and executed</div>",
                                                                 $this->ipsclass->adskin->form_yes_no('allow_html_mod', $this->registry_config['allow_html_mod']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Enable Item Guestbooks?</b>",
                                                                 $this->ipsclass->adskin->form_yes_no('enable_guestbooks', $this->registry_config['enable_guestbooks']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Allow IBF CODE for Guestbook Comments?</b>",
                                                                 $this->ipsclass->adskin->form_yes_no('allow_bbcode_gb', $this->registry_config['allow_bbcode_gb']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Allow HTML for Guestbook Comments?</b><div style='color:gray'>This will allow HTML to be posted and executed</div>",
                                                                 $this->ipsclass->adskin->form_yes_no('allow_html_gb', $this->registry_config['allow_html_gb']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->end_table();


        // Build the Featured Item HTML
        $this->ipsclass->adskin->td_header[] = array( "Option"  , "40%" );

        $this->ipsclass->adskin->td_header[] = array( "Value" , "60%" );

        $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Fusion Registry Main Menu Options" );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Enable Featured Item?</b><div style='color:gray'>This will highlight a particular item directly on the front page of the Fusion Registry.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no('enable_featured_item', $this->registry_config['enable_featured_item']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Featured Item ID</b><div style='color:gray'>Enter the Item ID to feature.</div>",
                                                                 $this->ipsclass->adskin->form_input('featured_item_id', $this->registry_config['featured_item_id']).'<br />'.
                                                                 $this->ipsclass->adskin->form_checkbox('featured_item_random', $this->registry_config['featured_item_random'], '1'). '&nbsp;Random? &nbsp;'.
                                                                 $this->ipsclass->adskin->form_checkbox('featured_item_only_image', $this->registry_config['featured_item_only_image'], '1'). '&nbsp;Only items with highlight images?',
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Featured Item Description</b><div style='color:gray'>Enter a quick description of the featured item.</div>",
                                                                 $this->ipsclass->adskin->form_input('featured_item_description', $this->registry_config['featured_item_description']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Display Member Search?</b><div style='color:gray'>Allows the search by member form to be shown on the main menu.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no( "main_searchmember_on", $this->registry_config['main_searchmember_on'] )
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Display Browse Table?</b><div style='color:gray'>Allows the browse table to be shown on the main menu.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no( "main_browse_on", $this->registry_config['main_browse_on'] )
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->end_table();

        $this->ipsclass->adskin->td_header[] = array( "Option"  , "40%" );

        $this->ipsclass->adskin->td_header[] = array( "Value" , "60%" );

        $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Fusion Registry Statistics Options" );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Date/Time Format</b><div style='color:gray'>Enter the format for the Date/Time strings. See <a href='http://www.php.net/manual/en/function.date.php' target='_blank'>php.net</a> for possible variables.</div><br /><b>DEFAULT:</b> m-j-y H:i",
                                                                 $this->ipsclass->adskin->form_input('date_format', $this->registry_config['date_format']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Enable Newest Items?</b><div style='color:gray'>Allows the newest added items to be shown on the statistics menu.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no( "tmpl_newestitems_on", $this->registry_config['tmpl_newestitems_on'] )
                                                                 ."<br />Max. no items to show: ".$this->ipsclass->adskin->form_input( "tmpl_newestitems_limit", $this->registry_config['tmpl_newestitems_limit'])
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Enable Updated Items?</b><div style='color:gray'>Allows the latest updated items to be shown on the statistics menu.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no( "tmpl_lastupdateditems_on", $this->registry_config['tmpl_lastupdateditems_on'] )
                                                                 ."<br />Max. no items to show: ".$this->ipsclass->adskin->form_input( "tmpl_lastupdateditems_limit", $this->registry_config['tmpl_lastupdateditems_limit'])
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Enable Newest Modifications?</b><div style='color:gray'>Allows the newest added modifications to be shown on the statistics menu.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no( "tmpl_newestmods_on", $this->registry_config['tmpl_newestmods_on'] )
                                                                 ."<br />Max. no modifications to show: ".$this->ipsclass->adskin->form_input( "tmpl_newestmods_limit", $this->registry_config['tmpl_newestmods_limit'])
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Enable Updated Modifications?</b><div style='color:gray'>Allows the latest updated modifications to be shown on the statistics menu.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no( "tmpl_lastupdatedmods_on", $this->registry_config['tmpl_lastupdatedmods_on'] )
                                                                 ."<br />Max. no modifications to show: ".$this->ipsclass->adskin->form_input( "tmpl_lastupdatedmods_limit", $this->registry_config['tmpl_lastupdatedmods_limit'])
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Enable Most Modded?</b><div style='color:gray'>Allows the most modded items to be shown on the statistics menu.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no( "tmpl_mostmodded_on", $this->registry_config['tmpl_mostmodded_on'] )
                                                                 ."<br />Max. no items to show: ".$this->ipsclass->adskin->form_input( "tmpl_mostmodded_limit", $this->registry_config['tmpl_mostmodded_limit'])
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Enable Most Money Spent?</b><div style='color:gray'>Allows the most money spent on items to be shown on the statistics menu.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no( "tmpl_mostmoneyspent_on", $this->registry_config['tmpl_mostmoneyspent_on'] )
                                                                 ."<br />Max. no items to show: ".$this->ipsclass->adskin->form_input( "tmpl_mostmoneyspent_limit", $this->registry_config['tmpl_mostmoneyspent_limit'])
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Enable Most Viewed?</b><div style='color:gray'>Allows the most viewed items to be shown on the statistics menu.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no( "tmpl_mostviewed_on", $this->registry_config['tmpl_mostviewed_on'] )
                                                                 ."<br />Max. no items to show: ".$this->ipsclass->adskin->form_input( "tmpl_mostviewed_limit", $this->registry_config['tmpl_mostviewed_limit'])
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Enable Latest Commented?</b><div style='color:gray'>Allows the latest commented items to be shown on the statistics menu.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no( "tmpl_lastcommented_on", $this->registry_config['tmpl_lastcommented_on'] )
                                                                 ."<br />Max. no comments to show: ".$this->ipsclass->adskin->form_input( "tmpl_lastcommented_limit", $this->registry_config['tmpl_lastcommented_limit'])
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->end_table();


        // Build the Image Config HTML
        $this->ipsclass->adskin->td_header[] = array( "Option"  , "40%" );

        $this->ipsclass->adskin->td_header[] = array( "Value" , "60%" );

        $this->ipsclass->html .= $this->ipsclass->adskin->start_table( "Fusion Registry Image Options" );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Allow Image Uploads?</b><div style='color:gray'>This will allow users to upload images to be displayed with their items and modifications.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no('allow_image_upload', $this->registry_config['allow_image_upload']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Allow Modification Images?</b><div style='color:gray'>This will allow users to upload an image for each listed modification in addition to the Max Images Per Item Gallery.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no('allow_mod_image', $this->registry_config['allow_mod_image']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Show Modification Images in Gallery?</b><div style='color:gray'>This will collectively show all the images for all the item modifications. You may set a maximum number of images to show in the gallery to prevent the page from filling up with images.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no('show_mod_gallery', $this->registry_config['show_mod_gallery'])
                                                                 ."<br />".$this->ipsclass->adskin->form_checkbox( 'limit_mod_gallery', $this->registry_config['limit_mod_gallery'] )."Limit number of mod images shown to ".$this->ipsclass->adskin->form_input( 'limit_mod_gallery_amount', $this->registry_config['limit_mod_gallery_amount'] ),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Allow users to use remote URL images?</b><div style='color:gray'>This will allow users to link to an image remotely for any images in the Fusion Registry.</div>",
                                                                 $this->ipsclass->adskin->form_yes_no('allow_image_url', $this->registry_config['allow_image_url']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Remote Timeout</b><div style='color:gray'>Enter the amount of time in whole seconds you want as a maximum time to wait to retrieve remote images.</div><br /><b>DEFAULT</b>: 60 $remote_timeout_warning",
                                                                 $this->ipsclass->adskin->form_input('remote_timeout', $this->registry_config['remote_timeout']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Max Images Per Item Gallery</b><div style='color:gray'>Enter the maximum number of images to allow in each item gallery. This does not include the modification images.<br />Set to 0 to disable.<br />Set to at least 1 to allow item highlight images.</div>",
                                                                 $this->ipsclass->adskin->form_input('max_car_images', $this->registry_config['max_car_images']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Maximum allowed image kbytes</b><div style='color:gray'>Format in kilobytes, like 1024 for 1MB.</div>",
                                                                 $this->ipsclass->adskin->form_input('max_image_kbytes', $this->registry_config['max_image_kbytes']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Maximum allowed image resolution</b><div style='color:gray'>Single pixel count for maximum length or width, like 800 for a max 800x800.</div>",
                                                                 $this->ipsclass->adskin->form_input('max_image_resolution', $this->registry_config['max_image_resolution']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Create Thumbnails Using?</b><div style='color:gray'>Using <a href='http://www.imagemagick.org' target='_blank'>ImageMagick</a> is recommended for producing better quality, smaller file size thumbnails.  GD is usually compiled into PHP so it might be the easiest to use and still produces similar quality thumbnails.</div><br /><b>NOTE:</b> The use of GD will rely on your forums General Configuration value for GD Version.  Please ensure this value is properly configured." ,
                                                          $this->ipsclass->adskin->form_dropdown( 'thumbnail_type',
                                                                                             array( 0 => array( 'imagemagick', 'ImageMagick' ),
                                                                                                    1 => array( 'gd', 'GD2/GD1' ) ),
                                                                                             $this->registry_config['thumbnail_type']
                                                                                          )
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Path to convert</b> <i>(If using ImageMagick)</i><div style='color:gray'>Set this to the path to your ImageMagick's command line tool 'convert'.  You may execute the command 'type convert' if you have shell access to your host if you do not know this path.</div><br /><b>DEFAULT:</b> /usr/bin/convert $path_warning<p /><b>For Windows:</b> Use forward slashes '/' in the path, and if it contains any spaces enclose the path in double quotes \"",
                                                                 $this->ipsclass->adskin->form_input('convert_path', $this->registry_config['convert_path']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Convert Options</b> <i>(If using ImageMagick)</i><div style='color:gray'>These are the command line options that will be passed to convert in making thumbnails.</div><br /><b>DEFAULT:</b> -antialias +profile \"*\"<br /><b>WINDOWS DEFAULT:</b> -antialias<br /><b>NOTE:</b> DO NOT include any scale, geometry, or resize options here.<p /><b>For Windows:</b> Remember to remove the +profile from the options!",
                                                                 $this->ipsclass->adskin->form_input('convert_options', $this->registry_config['convert_options']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->add_td_row( array( "<b>Thumbnail resolution</b><div style='color:gray'>Single pixel count for length or width, like 100 for a max 100x100. Aspect Ratio will be maintained where possible.</div>",
                                                                 $this->ipsclass->adskin->form_input('thumbnail_resolution', $this->registry_config['thumbnail_resolution']),
                                                        )      );

        $this->ipsclass->html .= $this->ipsclass->adskin->end_form("Save");

        $this->ipsclass->html .= $this->ipsclass->adskin->end_table();

        // That's all folk!
        $this->ipsclass->admin->output();
    }


    /**
     * Update/Rebuild cache
     *
     * This gets run any time a change is made and on demand in the ACP tools.
     */
    function update_cache()
    {
        // Start with an empty cache
        $this->ipsclass->cache['registry_config'] = array();

        $this->ipsclass->DB->simple_construct( array( 'select' => 'config_name,config_value', 'from' => 'registry_config' ) );
        $this->ipsclass->DB->simple_exec();

        // Loop through each setting
        while ( $row = $this->ipsclass->DB->fetch_row() )
        {
            $this->ipsclass->cache['registry_config'][ $row['config_name'] ] = $row['config_value'];
        }

        // Save it back to the cache_store
		$this->ipsclass->update_cache( array( 'name' => 'registry_config', 'array' => 1, 'deletefirst' => 1, 'donow' => 0 ) );
    }
}
?>